{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0c1bb09b",
   "metadata": {},
   "source": [
    "# jupyter notebook扩展 （插件nbextensions安装完毕）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8170894a",
   "metadata": {},
   "source": [
    "# 初识地图"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2d858c0c",
   "metadata": {},
   "source": [
    "# 地图JS API简介"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2c7c1479",
   "metadata": {},
   "source": [
    "   地图 JSAPI 2.0 是高德开放平台免费提供的第四代 Web 地图渲染引擎， 以 WebGL 为主要绘图手段，本着“更轻、更快、更易用”的服务原则，广泛采用了各种前沿技术，交互体验、视觉体验大幅提升，同时提供了众多新增能力和特性。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f9f9b0e6",
   "metadata": {},
   "source": [
    "2022/4/25 周一晚课"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "7af0847c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'113.678280,23.628439'"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#1、位置\n",
    "\n",
    "import requests\n",
    "\n",
    "geo_url = \"https://restapi.amap.com/v3/geocode/geo?parameters\"\n",
    "payload = {\n",
    "    \"key\":\"b0121f143057c2f0c3607e48fe21bac9\",\n",
    "    \"address\":\"广东省广州市从化区广州南方学院\"\n",
    "}\n",
    "r = requests.get(url=geo_url, params=payload)\n",
    "广州南方学院_location = r.json()['geocodes'][0]['location']\n",
    "广州南方学院_location"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8fd4527d",
   "metadata": {},
   "source": [
    "# 2、搜索POI\n",
    ">1.关键词（keywords）\n",
    ">2.分类（types）规范（POI编码表）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "a45e99cf",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (<ipython-input-11-164acd7f8ff0>, line 7)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-11-164acd7f8ff0>\"\u001b[1;36m, line \u001b[1;32m7\u001b[0m\n\u001b[1;33m    \"page\":1\u001b[0m\n\u001b[1;37m          ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "POI_url = 'https://restapi.amap.com/v3/place/around?parameters'\n",
    "\n",
    "payload = {\n",
    "    \"key\":\"b0121f143057c2f0c3607e48fe21bac9\",\n",
    "    \"location\":广州南方学院_location,\n",
    "    \"keywords\":\"中餐厅\"\n",
    "    \"page\":1\n",
    "}\n",
    "r = requests.get(POI_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "3c290f40",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'count': '1',\n",
       " 'geocodes': [{'formatted_address': '广东省广州市从化区温泉镇中心大学南方学院',\n",
       "   'country': '中国',\n",
       "   'province': '广东省',\n",
       "   'citycode': '020',\n",
       "   'city': '广州市',\n",
       "   'district': '从化区',\n",
       "   'township': [],\n",
       "   'neighborhood': {'name': [], 'type': []},\n",
       "   'building': {'name': [], 'type': []},\n",
       "   'adcode': '440117',\n",
       "   'street': [],\n",
       "   'number': [],\n",
       "   'location': '113.678280,23.628439',\n",
       "   'level': '兴趣点'}]}"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "0d182bc6",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c8543182",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
